﻿using System.Collections.Generic;
using System.Linq;

namespace CommonUtils
{
    public static class LinqUtil
    {
        public static T[] AddRange<T>(this IEnumerable<T> lines, params T[] appendLines)
        {
            var list = lines.ToList();
            list.AddRange(appendLines);
            return list.ToArray();
        }

        public static T[] DistinctSelf<T>(this IEnumerable<T> lines)
        => lines.Distinct().ToArray();

        public static T[] OrderSelfAsc<T>(this IEnumerable<T> lines)
        => lines.OrderBy(m => m).ToArray();

        public static T First<T>(this IEnumerable<T> lines)
        => lines.FirstOrDefault();
    }
}
